/**
 * @Description: uuid  // 类说明，在创建类时要填写
 * @ClassName: uuid    // 类名，会自动填充
 * @Author: wangtai          // 创建者
 * @Date: 2021/3/17 9:19   // 时间
 * @Version: 1.0     // 版本
 */

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class uuid {
    public static void main(String[] args) {
        Student stu1 = new Student();
        Student stu2 = new Student();
        stu1.setId("1");
        stu2.setId("2");
        List<Student> studentList = new ArrayList<>();
        studentList.add(stu1);
        studentList.add(stu2);

       // studentList=  studentList.stream().filter(stu->stu.getId().equals("1")).collect(Collectors.toList());
        long num = studentList.stream().map(Student::getId).distinct().count();

        System.out.println(num);
       // Map<String,String> map =studentList.stream().collect(Collectors.toMap(Student::getId,Student::getOnlyKey));
        Map<String,List<Student>> ml = studentList
                .stream().collect(Collectors.groupingBy(Student::getId));


        ml.forEach((k,v)->{
            System.out.println(k+"___");
            v.forEach(e->{
                System.out.println(  e.getId());
            });
        });
        System.out.println(studentList.stream().map(Student::getId).collect(Collectors.joining(",","[","]")));
    }
}
